#ifndef QUIZMAIN_H
#define QUIZMAIN_H
#include <QString>
#include <QList>
#include <QTimer>
#include "ChatterBoxServer.h"
#include <database.h>

class ChatterBoxServer;
class Database;

struct questionsList
{
    int nr;
    QString question;
    QString answer;
};

class QuizMain : public QObject
{
    Q_OBJECT
public:
    QuizMain(ChatterBoxServer *server,int helpT, int hlp);

    bool checkAnswer(QString name, QString answer);
    void displayCurrQuestion();
    void rewardUser(QString name);
    int getCurrQuestionID();
    QString getCurrQuestion();
    void addQuestion(QString quest, QString answer);
private:
    QList<questionsList> questions;
    QList<int> askedQuestions;
    ChatterBoxServer *chatSrv;
    questionsList currQuestion;
    Database *userSrv;
    int hintcount;
    int maxhlp;
    int hlpT;
    QTimer *timer;
    bool changing;
    void loadQuestionsList();
    void giveHint(int n);
private slots:
    void askQuestion();
    void Checker();
};

#endif // QUIZMAIN_H
